﻿#ifndef QCMDWIDGET_H
#define QCMDWIDGET_H

#include <QWidget>
#include <QLineEdit>
#include <QLabel>
#include <QMessageBox>
#include <QGridLayout>
#include <QComboBox>
#include <QPushButton>
#include <QDoubleValidator>
#include <qmap.h>
#include <QRadioButton>
#include <QButtonGroup>
#include <QCheckBox>
#include <QGroupBox>
#include "dataparamwidget.h"
#include "cmdparamwidget.h"
#include "cmddefine.h"

class QCmdWidget : public QWidget
{
    Q_OBJECT
public:
    explicit QCmdWidget(st_cmd cmd,QWidget *parent = nullptr);

signals:

    void signal_show_paramwidget(int nCmdIndex,int paramIndex);

     void signal_sendData(int nCmdIndex,int nItemCmdIndex,QByteArray data,int nItemByteNum);

public slots:

    void onCmdButtonClick(int buttonId);//按键1

    void onSendData(int nCmdItemId,QByteArray data,int nItemByteNum);




public:


    void setButtonEnable(int clickBtnId,bool bEnable);
    void setButtonChecked(int clickBtnId,bool bchecked);
    void onShowParamWidget(int nIndex);

    bool setParamData(int clickBtnId,QList<float> pValueList);


private:

    void InitUI();

    QWidget* createButtonStatusWidget(QButtonGroup* pGroup);
    void createParamWidget();

    void setParamWidgetHide(bool bhide);

    void setButtonStyleSheet(QPushButton* pBtn);


    QLabel* _pNoneButtonLabel;//没有button按钮被选中时 显示

    QMap<int,QWidget*> m_cmd_paraWidget;

    QButtonGroup* _pCmdButtonGroup;

    QSize _paramWidgetSize;




    st_cmd _my_cmd;
};

#endif // BUTTONSTARTUSWIDGET_H
